package com.cmsky.open.user.manager;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cmsky.open.core.base.*;

import com.cmsky.open.user.model.*;
import com.cmsky.open.user.dao.*;
import com.cmsky.open.user.vo.query.*;

/**
 * @author jandyfish email:jandyfish(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


@Service
@Transactional
public class UserInfoManager extends BaseManager<UserInfo,java.lang.Integer>{

	private UserInfoDao userInfoDao;
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setUserInfoDao(UserInfoDao dao) {
		this.userInfoDao = dao;
	}
	public EntityDao getEntityDao() {
		return this.userInfoDao;
	}
	
	@Transactional(readOnly=true)
	public BasePager findPage(UserInfoQuery query) {
		return userInfoDao.findPage(query);
	}
	@Override
	public int saveOrUpdate(UserInfo entity) throws DataAccessException {
		if(null == entity.getId() || 0 >= entity.getId()){
			return this.save(entity);
		}else{
			return this.update(entity);
		}
	}
	
	public int updatePass(UserInfoQuery query){
		return this.userInfoDao.updatePass(query);
	}
}
